package object;

import java.util.Objects;

/***
 * Objects类
 */
public class MyObjectsDemo {
    public static void main(String[] args) {

        Student s = null;
        Student ss = new Student();
        Student sss = new Student("小明同学", 25);

        // toString(对象)      返回参数中对象的字符串表示形式
        System.out.println(Objects.toString(new Student("罗志祥", 30)));


        // toString(对象，默认字符串)   返回对象的字符串表示形式
        System.out.println(Objects.toString(s, "fwef"));

        // isNull(对象)              判断对象是否为空
        System.out.println(Objects.isNull(s));
        System.out.println(Objects.isNull(ss));

        // nonNull(对象)             判断对象是否不为空
        System.out.println(Objects.nonNull(s));
        System.out.println(Objects.nonNull(ss));


    }
}
